<?php
class Danhmucsp extends CI_Model{
    function __construct() {
        parent::__construct();
    }
    
    function selectAll($where = null) {
        if($where!=null){
            foreach ($where as $field => $value) {
                if($field[0]=='?'){
                    $this->db->where_in(substr($field, 1),$value);
                }else if($field[0] == '!'){
                    $this->db->where_not_in(substr($field, 1),$value);
                }else{
                    $this->db->where($field,$value);
                }
            }
        }
        $q = $this->db->get('category');
        return $q;
       
    }
    
    function GetCategory($menu_id){
        if($menu_id){
            $this->db->where("menu_id", $menu_id);
            $rs = $this->db->get("category");
            if($rs->num_rows() > 0){
                return $rs;
            }else{
                return $rs;
            }
        }
    }
}
?>
